EditorApi

interface EditorApi

Functions

Link copied to clipboard
abstract fun addUndoStep()

Adds a new history state to the stack, if undoable changes were made.

Link copied to clipboard
abstract fun addVectorNode()

Add a new vertex by splitting the segment after the currently selected vector node.

Link copied to clipboard
abstract fun canRedo(): Boolean

If a redo step is available.

Link copied to clipboard
abstract fun canUndo(): Boolean

If an undo step is available.

Link copied to clipboard
abstract fun checkP3Support()

Throws an exception if the device does not support displaying and working in the P3 color space on the current device. If no exception is thrown, the engine can be switched to a P3 color space using the "features/p3WorkingColorSpace" setting.

Link copied to clipboard
abstract fun convertColorToColorSpace(color: Color, colorSpace: ColorSpace): Color

Converts a color to the given color space.

Link copied to clipboard
abstract fun createBuffer(): Uri

Create a resizable buffer that can hold arbitrary data.

Link copied to clipboard
abstract fun createHistory(): History
Link copied to clipboard
abstract fun defaultUriResolver(uri: Uri): Uri

This is the default implementation for the Uri resolver. If uri is absolute no adjustments are made. If it is relative, it resolves the given Uri relative to the basePath setting, which is "file:///android_asset" by default (assets base uri).

Link copied to clipboard

Delete the selected vector control points.

Link copied to clipboard
abstract fun deleteVectorNode()

Delete the currently selected vector node from the path.

Link copied to clipboard
abstract fun destroyBuffer(uri: Uri)

Destroy a buffer and free its resources.

Link copied to clipboard
abstract fun destroyHistory(history: History)

Destroy the given history, returns an error if the handle doesn't refer to a history.

Link copied to clipboard
abstract fun findAllMediaURIs(): List<Uri>

Returns all media URIs referenced by blocks in the scene. Note: This function retrieves URIs from image fills, video fills, and audio blocks, including their source sets. Only returns valid media URIs (http://, https://, file://), excluding transient resources like buffer URIs. Useful for determining which media files are referenced by a scene (e.g., for cleanup operations, CDN management).

Link copied to clipboard
abstract fun findAllScopes(): List<String>

Gets all available global scopes that can be set.

Link copied to clipboard
abstract fun findAllSettings(): List<String>

Returns a list of all the settings available.

Link copied to clipboard
abstract fun findAllSpotColors(): List<String>

Queries the names of currently set spot colors previously set with setSpotColor`.

Link copied to clipboard

Returns the Uris and sizes of all resources whose data would be lost if the scene was exported. Note: This function is useful for determining which resources need to be relocated (e.g., to a CDN) before exporting a scene since the resources are not included in the exported scene.

Link copied to clipboard
abstract suspend fun getAbsoluteUri(uri: Uri): Uri

Resolves the given uri asynchronously. If a custom resolver has been set with setUriResolver, it uses the custom resolver. Else, it resolves using defaultUriResolver.

Link copied to clipboard
abstract fun getActiveHistory(): History

Get the handle to the currently active history. If there's none it will be created.

Link copied to clipboard
abstract fun getActiveLicense(): String

Get the active license of the engine.

Link copied to clipboard
abstract fun getAvailableMemory(): Long

Get the currently available memory in bytes.

Link copied to clipboard
abstract fun getBufferData(uri: Uri, offset: Int, length: Int): ByteBuffer

Get the data of a buffer.

Link copied to clipboard
abstract fun getBufferLength(uri: Uri): Int

Get the length of a buffer.

Link copied to clipboard
abstract fun getEditMode(): String

Get the current edit mode of the editor. An edit mode defines what type of content can currently be edited by the user.

Link copied to clipboard
abstract suspend fun getFontMetrics(fontFileUri: String): FontMetrics

Returns the font metrics for a given font file URI. If the font is not yet loaded, it will be fetched asynchronously. The returned metrics are in the font's design units coordinate space.

Link copied to clipboard
abstract fun getGlobalScope(key: String): GlobalScope

Query the state of a global scope.

Link copied to clipboard
abstract fun getMaxExportSize(): Int

Get the export size limit in pixels on the current device. An export is only possible when both the width and height of the output are below or equal this limit. However, this is only an upper limit as the export might also not be possible due to other reasons, e.g., memory constraints.

Link copied to clipboard
abstract suspend fun getMimeType(uri: Uri): String

Returns the mimetype of the resources at the given Uri. If the resource is not already downloaded, this function will download it.

Link copied to clipboard

Get when the standalone move handle is shown for the selected block.

Link copied to clipboard

Get the effective movement constraint for a block, picking the most specific matching rule: block parent page blockType scene-wide.

Link copied to clipboard

Get when the edge (resize) handles are shown for the selected block.

Link copied to clipboard
abstract fun getResourceData(uri: Uri, chunkSize: Int, onData: (ByteBuffer) -> Boolean)

Provides the data of a resource at the given Uri. Note that it is a synchronous function and all the chunks are provided immediately before the function returns.

Link copied to clipboard
abstract fun getRole(): String

Get the current role of the user

Link copied to clipboard

Get when the rotation handle is shown for the selected block.

Link copied to clipboard

Get when the corner (scale) handles are shown for the selected block.

Link copied to clipboard

Get the bezier handle mirror mode of the currently selected vector node.

Link copied to clipboard
abstract fun getSettingBoolean(keypath: String): Boolean

Get a boolean setting.

Link copied to clipboard
abstract fun getSettingColor(keypath: String): RGBAColor

Get a color setting.

Link copied to clipboard
abstract fun getSettingEnum(keypath: String): String

Get an enum setting.

Link copied to clipboard
abstract fun getSettingEnumOptions(keypath: String): List<String>

Get all the available options of an enum setting.

Link copied to clipboard
abstract fun getSettingFloat(keypath: String): Float

Get a float setting.

Link copied to clipboard
abstract fun getSettingInt(keypath: String): Int

Get an integer setting.

Link copied to clipboard
abstract fun getSettingString(keypath: String): String

Get a string setting.

Link copied to clipboard
abstract fun getSettingType(keypath: String): PropertyType

Get the type of a setting.

Link copied to clipboard
abstract fun getSpotColor(name: String): RGBAColor

Queries the RGB representation set for a spot color. If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta). The alpha value is always 1.0.

Link copied to clipboard
abstract fun getSpotColorCMYK(name: String): CMYKColor

Queries the CMYK representation set for a spot color. If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta).

Link copied to clipboard
abstract fun getSpotColorRGB(name: String): RGBAColor

Queries the RGB representation set for a spot color. If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta). The alpha value is always 1.0.

Link copied to clipboard

Get the current text cursor's x position in screen space.

Link copied to clipboard

Get the current text cursor's y position in screen space.

Link copied to clipboard
abstract fun getUsedMemory(): Long

Get the current memory usage of the editor in bytes.

Link copied to clipboard

Check whether vector edit add mode is currently active.

Link copied to clipboard

Check whether vector edit bend mode is currently active.

Link copied to clipboard

Check whether vector edit delete mode is currently active.

Link copied to clipboard

Check if there is a selected vector control point.

Link copied to clipboard

Check whether a vector anchor node is currently selected in vector edit mode.

Link copied to clipboard

Checks wether the block has selection and hover highlighting enabled or disabled.

Link copied to clipboard

If an user interaction is happening, e.g., a resize edit with a drag handle or a touch gesture.

Link copied to clipboard
abstract fun isSelectionEnabled(block: DesignBlock): Boolean

Checks whether the block can currently be selected.

Link copied to clipboard
abstract fun onCarouselPageChanged(): Flow<DesignBlock>

Subscribe to current page changes when page carousel mode is enabled. Note: This is only triggered when page carousel mode is enabled (features/pageCarouselEnabled).

Link copied to clipboard
abstract fun onHistoryUpdated(): Flow<Unit>

Subscribe to changes to the undo/redo history.

Link copied to clipboard

Subscribe to changes to the undo/redo history.

Link copied to clipboard
abstract fun onRoleChanged(): Flow<String>

Subscribe to changes to the editor role.

Link copied to clipboard
abstract fun onSettingsChanged(): Flow<Unit>

Subscribe to changes to the editor settings.

Link copied to clipboard
abstract fun onStateChanged(): Flow<Unit>

Subscribe to changes to the editor state.

Link copied to clipboard
abstract fun redo()

Redo one step in the history if a redo step is available.

Link copied to clipboard
abstract fun relocateResource(currentUri: Uri, relocatedUri: Uri)

Changes the uri associated with a resource. Note: This function can be used change the Uri of a resource that has been relocated (e.g., to a CDN).

Link copied to clipboard

Remove the scene-wide default movement constraint. Removing a scope falls through to the next tier on subsequent resolution.

Remove multiple movement constraint scopes at once. An empty list is a no-op; use removeMovementConstraint with no arguments to remove the scene-wide default.

Remove the movement constraint for a specific scope. Removing a scope falls through to the next tier on subsequent resolution.

Link copied to clipboard
abstract fun removeSpotColor(name: String)

Removes a spot color from the list of set spot colors.

Link copied to clipboard
abstract fun removeUndoStep()

Removes the last history state from the stack, if available.

Link copied to clipboard
abstract fun setActiveHistory(history: History)

Mark the given history as active, returns an error if the handle doesn't refer to a history. All other histories get cleared from the active state. Undo/redo operations only apply to the active history.

Link copied to clipboard
abstract fun setAppIsPaused(paused: Boolean)

Inform the engine that the app went to the background when paused. When the app is paused, the engine will try to release resources to save memory. The audio output device will be suspended on pause. It starts again automatically as soon as a block is playing or can be started manually with startAudioOutputDevice.

Link copied to clipboard
abstract fun setBufferData(uri: Uri, offset: Int, data: ByteBuffer)

Set the data of a buffer.

Link copied to clipboard
abstract fun setBufferLength(uri: Uri, length: Int)

Set the length of a buffer.

Link copied to clipboard
abstract fun setEditMode(editMode: String)

Set the edit mode of the editor. An edit mode defines what type of content can currently be edited by the user. Note: The initial edit mode is "Transform".

abstract fun setEditMode(editMode: String, baseMode: String)

Set the edit mode of the editor using another edit mode as a base. An edit mode defines what type of content can currently be edited by the user.

Link copied to clipboard
abstract fun setGlobalScope(key: String, globalScope: GlobalScope)

Set a scope to be globally allowed, denied, or deferred to the block-level.

Link copied to clipboard
abstract fun setHighlightingEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable selection and hover highlighting for a block.

Link copied to clipboard

Set when the standalone move handle is shown for the selected block.

Link copied to clipboard

Set multiple movement constraint rules at once. See setMovementConstraint for details on a single rule.

Set a rule that limits how far blocks can be positioned outside their parent page during user interactions (drag, resize, touch gestures, crop). Programmatic API calls are not affected.

Link copied to clipboard

Set when the edge (resize) handles are shown for the selected block.

Link copied to clipboard
abstract fun setRole(role: String)

Set the role of the user and apply role-dependent defaults for scopes and settings

Link copied to clipboard

Set when the rotation handle is shown for the selected block.

Link copied to clipboard

Set when the corner (scale) handles are shown for the selected block.

Link copied to clipboard

Set the bezier handle mirror mode for the currently selected vector node.

Link copied to clipboard
abstract fun setSelectionEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable selection for a block.

Link copied to clipboard
abstract fun setSettingBoolean(keypath: String, value: Boolean)

Set a boolean setting.

Link copied to clipboard
abstract fun setSettingColor(keypath: String, value: RGBAColor)

Set a color setting.

Link copied to clipboard
abstract fun setSettingEnum(keypath: String, value: String)

Set an enum setting.

Link copied to clipboard
abstract fun setSettingFloat(keypath: String, value: Float)

Set a float setting.

Link copied to clipboard
abstract fun setSettingInt(keypath: String, value: Int)

Set an integer setting.

Link copied to clipboard
abstract fun setSettingString(keypath: String, value: String)

Set a string setting.

Link copied to clipboard
abstract fun setSpotColor(name: String, color: CMYKColor)

Sets the CMYK representation of a spot color. Use this function to both create a new spot color or update an existing spot color.

abstract fun setSpotColor(name: String, color: RGBAColor)

Sets the RGB representation of a spot color. Use this function to both create a new spot color or update an existing spot color. Note: The alpha value is ignored.

Link copied to clipboard
abstract fun setUriResolver(resolver: (Uri) -> Uri?)

Sets a custom Uri resolver. This method can be called more than once. Subsequent calls will overwrite previous calls. To remove a previously set resolver, pass the value null. Note: The given function must return an absolute path with a scheme.

Link copied to clipboard
abstract fun setUriResolverAsync(resolver: suspend (Uri) -> Uri?)

Sets a custom async Uri resolver. This method can be called more than once. Subsequent calls will overwrite previous calls. To remove a previously set resolver, pass the value null.

Link copied to clipboard
abstract fun setVectorEditAddMode(active: Boolean)

Enable or disable add mode for vector editing.

Link copied to clipboard
abstract fun setVectorEditBendMode(active: Boolean)

Enable or disable bend mode for vector editing.

Link copied to clipboard
abstract fun setVectorEditDeleteMode(active: Boolean)

Enable or disable delete mode for vector editing.

Link copied to clipboard
abstract fun startAudioOutputDevice()

Start the audio output device. Usually not needed as the device will automatically start when a block is set to playing. Useful to call when the app is resumed and you want to ensure audio playback is resumed as well. Can also be used to manually start the audio output device, e.g., before a recording.

Link copied to clipboard
abstract fun supportsP3(): Boolean

Returns whether the engine supports displaying and working in the P3 color space on the current device. If supported, the engine can be switched to a P3 color space using the "features/p3WorkingColorSpace" setting.

Link copied to clipboard

Toggle the currently selected vector node between smooth (bezier handles) and corner (no handles).

Link copied to clipboard
abstract fun undo()

Undo one step in the history if an undo step is available.